home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 February / Gamestar_81_2006-02_dvd.iso / Red Shark / Missions / Mission_7 / MissionTasks.script < prev    next >
Text File  |  2001-12-19  |  8KB  |  435 lines

  1. //-------------------------------------------------------------------
  2. //
  3. //  This code is copyright 2001 by G5 Software.
  4. //  Any unauthorized usage, either in part or in whole of this code
  5. //  is strictly prohibited. Violators WILL be prosecuted to the
  6. //  maximum extent allowed by law.
  7. //
  8. //-------------------------------------------------------------------
  9.  
  10. ///////////////////////////////////
  11. //
  12. // Mission 7. Break ring (Kursk Ark)
  13. //
  14. //
  15.  
  16. class CMission7_AIController extends CBaseAIController
  17. {
  18.   array  ActivatePointCenterList = array(
  19.     vector( 8600, 10800, 0),    // ring is broken
  20.     vector( 7360, 9900, 0),     // B
  21.     vector( 7526, 10640, 0),    // D
  22.     vector( 5800, 9040, 0),     // E
  23.     vector( 4600, 7760, 0),     // F
  24.     vector( 4600, 7760, 0),     // G
  25.     vector( 5580, 8020, 0),     // H
  26.     vector( 6520, 6260, 0),     // L
  27.     vector( 6520, 6260, 0),     // K
  28.     vector( 8090, 4900, 0),     // N
  29.     vector( 8090, 4900, 0),     // SovietWall
  30.     vector( 9390, 4460, 0),     // convoy stop (1)
  31.     vector( 12200, 4706, 0));   // convoy stop (2)
  32.  
  33.   array  ActivatePointRadiusList = array(
  34.     20.0,                       // radius of "ring is broken"
  35.     80.0,
  36.     80.0,
  37.     80.0,
  38.     80.0,
  39.     80.0,
  40.     80.0,
  41.     80.0,
  42.     80.0,
  43.     80.0,
  44.     150.0,
  45.     20.0,
  46.     100.0);
  47.  
  48.   array  ActivatePointNameList = array(
  49.     "Broken",
  50.     "B",
  51.     "D",
  52.     "E",
  53.     "F",
  54.     "G",
  55.     "H",
  56.     "L",
  57.     "K",
  58.     "N",
  59.     "SovietWall",
  60.     "ConvoyStop",
  61.     "ConvoyStop2");
  62.  
  63.  
  64.   void OnObjectEnterArea( int _NavPointIndex, string _NavPointName, string _ObjectID)
  65.   {
  66.     Core_LogMessage("GameObject <" + _ObjectID + "> entered activate area");
  67.  
  68.     if ( _NavPointName == "Broken"
  69.       && Core_IsStringStartsWith( _ObjectID, "Soviet"))
  70.     {
  71.       // Ring is broken
  72.       Core_BroadcastEvent("OnRingIsBroken");
  73.     };
  74.  
  75.     if ( _NavPointIndex >= 1 && _NavPointIndex <= 10
  76.       && Core_IsStringStartsWith( _ObjectID, "Soviet"))
  77.     {
  78.       // activate ambush
  79.       Core_BroadcastEvent("OnActiveArea_" + ActivatePointNameList[_NavPointIndex]);
  80.     }
  81.  
  82.     if ( _NavPointIndex == 11
  83.       && Core_IsStringStartsWith( _ObjectID, "SovietConvoy"))
  84.     {
  85.       Core_BroadcastEvent("OnConvoyStop");
  86.     };
  87.  
  88.     if ( _NavPointIndex == 12
  89.       && Core_IsStringStartsWith( _ObjectID, "SovietConvoy"))
  90.     {
  91.       Core_BroadcastEvent("OnConvoyStop2");
  92.     };
  93.   };
  94. }
  95.  
  96.  
  97. class CMission7_SovietAttack extends CBaseAITask_Patrol
  98. {
  99.   int m_StartTime;
  100.  
  101.   boolean m_ActivateOnTimer = true;
  102.  
  103.   void Init()
  104.   {
  105.     DeactivatePatrol();
  106.     SetFireStyle_NoFire();
  107.  
  108.     m_StartTime = GetGameTime();
  109.   }
  110.  
  111.   void OnUpdate()
  112.   {
  113.     if ( m_ActivateOnTimer)
  114.     {
  115.       if ( GetGameTime() > m_StartTime + 60000)
  116.       {
  117.         m_ActivateOnTimer = false;
  118.         ActivatePatrol();
  119.         SetFireStyle_Nearest();
  120.       };
  121.     };
  122.   };
  123.  
  124.   void OnGroupABroken()
  125.   {
  126.     ActivatePatrol();
  127.   };
  128.  
  129.   array GetPatrolTrip()
  130.   {
  131.     return array(
  132.       vector( 9100, 10326, 0),
  133.       vector( 7526, 10639, 0),
  134.       vector( 6257, 9677, 0),
  135.       vector( 4753, 6481, 0),
  136.       vector( 8924, 4377, 0),
  137.       vector( 12200, 4706, 0));
  138.   }
  139.  
  140.   float GetTripSpeed()
  141.   {
  142.     return 24;
  143.   }
  144.  
  145.   boolean Stopped = false;
  146.   void OnConvoyStop()
  147.   {
  148.     if ( !Stopped)
  149.     {
  150.       DeactivatePatrol();
  151.       SetOrder_StopNow();
  152.       Stopped = true;
  153.     };
  154.   }
  155.  
  156.   void OnConvoyStop2()
  157.   {
  158.     DeactivatePatrol();
  159.     SetOrder_StopNow();
  160.     Stopped = true;
  161.   }
  162.  
  163.   void OnConvoyContinue()
  164.   {
  165.     ActivatePatrol();
  166.   };
  167.  
  168.   void OnEnemyTargeted() {} // do not attack
  169. }
  170.  
  171. class CMission7_NaziAttack extends CBaseAITask_BaseTask
  172. {
  173.   int      m_StartTime;
  174.   boolean  m_Active = false;
  175.  
  176.   void Init()
  177.   {
  178.     m_StartTime = GetGameTime();
  179.     SetFireStyle_NoFire();
  180.   }
  181.  
  182.   void OnUpdate()
  183.   {
  184.     if ( !m_Active)
  185.     {
  186.       if ( GetGameTime() > m_StartTime + 60000)
  187.       {
  188.         DoAttack();
  189.       };
  190.     };
  191.   }
  192.  
  193. /*
  194.   void OnGroupABroken()
  195.   {
  196.     DoAttack();
  197.   }
  198. */
  199.  
  200.   void OnRingIsBroken()
  201.   {
  202.     DoAttack();
  203.   }
  204.  
  205.   void DoAttack()
  206.   {
  207.     SetFireStyle_Nearest();
  208.     string NearestEnemy = GetTargetedEnemy();
  209.  
  210.     if ( NearestEnemy == "")
  211.     {
  212.       NearestEnemy = GetNearestEnemyUnit();
  213.     };
  214.  
  215.     SetOrder_Attack( NearestEnemy, 100.0, 150.0, 30.0);
  216.     SetFireStyle_Enemy( NearestEnemy);
  217.  
  218.     m_Active = true;
  219.   }
  220.  
  221.   void OnOrderedEnemyKilled()
  222.   {
  223.     SetFireStyle_Nearest();
  224.     DoAttack();
  225.   }
  226. }
  227.  
  228. class CMission7_BaseAmbush extends CBaseAITask_BaseTask
  229. {
  230.   boolean m_Active = false;
  231.  
  232.   void DoAttack()
  233.   {
  234.     string NearestEnemy = GetTargetedEnemy();
  235.  
  236.     if ( NearestEnemy == "")
  237.     {
  238.       NearestEnemy = GetNearestEnemyUnit();
  239.     };
  240.  
  241.     SetOrder_Attack( NearestEnemy, 100.0, 150.0, 30.0);
  242.     SetFireStyle_Enemy( NearestEnemy);
  243.  
  244.     m_Active = true;
  245.   }
  246.  
  247.   void OnOrderedEnemyKilled()
  248.   {
  249.     SetFireStyle_Nearest();
  250.     DoAttack();
  251.   }
  252. }
  253.  
  254. class CMission7_Ambush_B extends CMission7_BaseAmbush
  255. {
  256.   void OnActiveArea_B()
  257.   {
  258.     if ( !m_Active)
  259.     {
  260.       DoAttack();
  261.     };
  262.   }
  263. }
  264.  
  265. class CMission7_Ambush_D extends CMission7_BaseAmbush
  266. {
  267.   void OnActiveArea_D()
  268.   {
  269.     if ( !m_Active)
  270.     {
  271.       DoAttack();
  272.     };
  273.   }
  274. }
  275.  
  276. class CMission7_Ambush_E extends CMission7_BaseAmbush
  277. {
  278.   void OnActiveArea_E()
  279.   {
  280.     if ( !m_Active)
  281.     {
  282.       DoAttack();
  283.     };
  284.   }
  285. }
  286.  
  287. class CMission7_Ambush_F extends CMission7_BaseAmbush
  288. {
  289.   void OnActiveArea_F()
  290.   {
  291.     if ( !m_Active)
  292.     {
  293.       DoAttack();
  294.     };
  295.   }
  296. }
  297.  
  298. class CMission7_Ambush_G extends CMission7_BaseAmbush
  299. {
  300.   void OnActiveArea_G()
  301.   {
  302.     if ( !m_Active)
  303.     {
  304.       DoAttack();
  305.     };
  306.   }
  307. }
  308.  
  309. class CMission7_Ambush_H extends CMission7_BaseAmbush
  310. {
  311.   void OnActiveArea_H()
  312.   {
  313.     if ( !m_Active)
  314.     {
  315.       DoAttack();
  316.     };
  317.   }
  318. }
  319.  
  320. class CMission7_Ambush_I extends CMission7_BaseAmbush
  321. {
  322.   void OnActiveArea_I()
  323.   {
  324.     if ( !m_Active)
  325.     {
  326.       DoAttack();
  327.     };
  328.   }
  329. }
  330.  
  331. class CMission7_Ambush_J extends CMission7_BaseAmbush
  332. {
  333.   void OnActiveArea_J()
  334.   {
  335.     if ( !m_Active)
  336.     {
  337.       DoAttack();
  338.     };
  339.   }
  340. }
  341.  
  342. class CMission7_Ambush_L extends CMission7_BaseAmbush
  343. {
  344.   void OnActiveArea_L()
  345.   {
  346.     if ( !m_Active)
  347.     {
  348.       DoAttack();
  349.     };
  350.   }
  351. }
  352.  
  353. class CMission7_Ambush_K extends CMission7_BaseAmbush
  354. {
  355.   void OnActiveArea_K()
  356.   {
  357.     if ( !m_Active)
  358.     {
  359.       DoAttack();
  360.     };
  361.   }
  362. }
  363.  
  364. class CMission7_Ambush_N extends CMission7_BaseAmbush
  365. {
  366.   void OnActiveArea_N()
  367.   {
  368.     if ( !m_Active)
  369.     {
  370.       DoAttack();
  371.     };
  372.   }
  373. }
  374.  
  375. class CMission7_Ambush_M extends CMission7_BaseAmbush
  376. {
  377.   void OnActiveArea_M()
  378.   {
  379.     if ( !m_Active)
  380.     {
  381.       DoAttack();
  382.     };
  383.   }
  384. }
  385.  
  386. class CMission7_Ambush_O extends CMission7_BaseAmbush
  387. {
  388.   void OnActiveArea_O()
  389.   {
  390.     if ( !m_Active)
  391.     {
  392.       DoAttack();
  393.     };
  394.   }
  395. }
  396.  
  397. class CMission7_SovietWall extends CBaseAITask_BaseTask
  398. {
  399.   boolean  m_Active = false;
  400.  
  401.   void Init()
  402.   {
  403.   }
  404.  
  405.   void DoAttack()
  406.   {
  407.     string NearestEnemy = GetTargetedEnemy();
  408.  
  409.     if ( NearestEnemy == "")
  410.     {
  411.       NearestEnemy = GetNearestEnemyUnit();
  412.     };
  413.  
  414.     SetOrder_Attack( NearestEnemy, 100.0, 150.0, 40.0);
  415.     SetFireStyle_Enemy( NearestEnemy);
  416.  
  417.     m_Active = true;
  418.   }
  419.  
  420.   void OnOrderedEnemyKilled()
  421.   {
  422.     SetFireStyle_Nearest();
  423.     DoAttack();
  424.   }
  425.  
  426.   void OnActiveArea_SovietWall()
  427.   {
  428.     if ( !m_Active)
  429.     {
  430.       DoAttack();
  431.     };
  432.   }
  433. }
  434.  
  435.